using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;
using RS.Controls.Timeline;
using RS.Controls.Timeline.Services;

namespace TimeLineTest
{
    public partial class MainForm : KryptonForm
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            timeLine1.Duration = 5000;
            propertyGrid.SelectedObject = timeLine1;
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            timeLine1.OnTimeSliceClicked += new RS.Controls.Timeline.TimeLine.TimeSliceEventHandler(timeLine1_OnTimeSliceClicked);
            timeLine1.OnEndReached += new RS.Controls.Timeline.TimeLine.TimeSliceEventHandler(timeLine1_OnEndReached);
        }

        void timeLine1_OnEndReached(object sender, TimeLineEventArgs args)
        {
            LoggingService.Debug("End reached");
        }

        void timeLine1_OnTimeSliceClicked(object sender, RS.Controls.Timeline.TimeLineEventArgs args)
        {
            ITimeSlice slice = args.Slice;
        }

        /// <summary>
        /// Handles the Click event of the bStart control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void bStart_Click(object sender, EventArgs e)
        {
            if (!bStart.Checked)
            {
                timeLine1.Reset();
                bStart.Text = "Play";
            }
            else
            {
                //timeLine1.Duration = _duration * 1000;
                //timeLine1.IsLoop = _isLoop;
                timeLine1.Play();
                bStart.Text = "Stop";
            }
        }

        private void kryptonCheckButton1_Click(object sender, EventArgs e)
        {

        }

        

        private void cbLoop_CheckedChanged(object sender, EventArgs e)
        {
            //_isLoop = cbLoop.Checked;
        }
    }
}